

def toJson(value):
    class TempObj:
        def __init__(self, data):
            self.__dict__ = data
    return TempObj(value)
def list2Json(value):
    if isinstance(value,list):
        ret = []
        for v in value: 
            ret.append(toJson(v))
        return ret
    elif isinstance(value,dict):
        return toJson(value)
    else:
        return value
